﻿@model RestApp.UI.Models.EditableUser

@{
    ViewBag.Title = "Edit";
}
<link href="~/Content/datepicker3.css" rel="stylesheet" />
<h2>Редактирование сотрудника</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

	<div class="form-horizontal">
		<h4>Пожалуйста, заполните форму корректными данными</h4>
		<hr />
		@Html.ValidationSummary(true, "", new { @class = "text-danger" })

		<div class="form-group">
			@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.MiddleName, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.MiddleName, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.MiddleName, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.Login, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.Login, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.Login, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.Salary, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.Salary, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.Salary, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.StartWorkDate, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.StartWorkDate, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.StartWorkDate, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.DateBirth, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.DateBirth, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.DateBirth, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.IdRole, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.DropDownListFor(model => model.IdRole, ViewData["roles"] as SelectList, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.IdRole, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.IdJobPost, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.DropDownListFor(model => model.IdJobPost, ViewData["jobTitles"] as SelectList, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.IdJobPost, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.IsFired, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.IsFired, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.IsFired, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.FireDate, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.FireDate, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.FireDate, "", new { @class = "text-danger" })
			</div>
		</div>

		<div class="form-group">
			@Html.LabelFor(model => model.FireComment, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.EditorFor(model => model.FireComment, new { htmlAttributes = new { @class = "form-control" } })
				@Html.ValidationMessageFor(model => model.FireComment, "", new { @class = "text-danger" })
			</div>
		</div>
		
		<div class="form-group">
			@Html.LabelFor(model => model.IdBossJobPost, htmlAttributes: new { @class = "control-label col-md-3" })
			<div class="col-md-9">
				@Html.DropDownListFor(model => model.IdBossJobPost, ViewData["jobBossTitles"] as SelectList, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.IdBossJobPost, "", new { @class = "text-danger" })
			</div>
		</div>

        <div class="form-group">
            <div class="col-md-offset-5 col-md-5">
                <input type="submit" value="Сохранить" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("<< Список сотрудников", "List")
</div>

@section scripts {
    @System.Web.Optimization.Scripts.Render("~/bundles/jqueryval")
    @System.Web.Optimization.Scripts.Render("~/bundles/editUser")
}